import axios from 'axios';
import api from 'api/api'

//sys后台用户登录
export function login(username,password){
    let url='/profit/admin-login';
    let data={
        username:username,
        password:password
    }
    return api.post(url,data);
}

//sys后台用户登出
export function loginOut(){
    let url='/profit/admin-logout';
    return api.get(url);
}

//sys后台利润(按日期)
export function profitDate(time,page,pageSize,sort_by){
    let url='/profit/date-profit';
    let data={
        start_time:time[0]?time[0]:0,
        end_time:time[1]?time[1]:0,
        page:page,
        pageSize:pageSize,
        sort_by:sort_by
    }
    return api.get(url, {params: data});
}

//sys后台利润(按游戏)
export function profitGame(time,page,pageSize,sort_by,sort_name){
    let url='/profit/game-profit';
    let data={
        start_time:time[0]?time[0]:0,
        end_time:time[1]?time[1]:0,
        page:page,
        pageSize:pageSize,
        sort_by:sort_by,
        sort_name:sort_name
    }
    return api.get(url, {params: data});
}

//sys后台利润(按游戏类型)
export function profitType(time,page,pageSize,sort_by,sort_name){
    let url='/profit/type-profit';
    let data={
        start_time:time[0]?time[0]:0,
        end_time:time[1]?time[1]:0,
        page:page,
        pageSize:pageSize,
        sort_by:sort_by,
        sort_name:sort_name
    }
    return api.get(url, {params: data});
}

//sys后台利润(按发行商)
export function profitPublish(time,page,pageSize,sort_by,sort_name){
    let url='/profit/publisher-profit';
    let data={
        start_time:time[0]?time[0]:0,
        end_time:time[1]?time[1]:0,
        page:page,
        pageSize:pageSize,
        sort_by:sort_by,
        sort_name:sort_name
    }
    return api.get(url, {params: data});
}

//sys后台充值排行榜
export function  accountRank(time,username,page,pageSize,sort_by,sort_name){
    let url='/rank/account';
    let data={
        start_time:time[0]?time[0]:0,
        end_time:time[1]?time[1]:0,
        username:username,
        page:page,
        pageSize:pageSize,
        sort_by:sort_by,
        sort_name:sort_name
    }
    return api.get(url, {params: data});
}

//sys后台详情(账号充值)
export function  accountDetail(username,page,pageSize){
    let url='/rank/account-details';
    let data={
        username:username,
        page:page,
        pageSize:pageSize,
    }
    return api.get(url, {params: data});
}

//维护详情
export function  rankMaintain(username,type){
    let url='/rank/maintain';
    let data={
        username:username,
        type:type
    }
    return api.get(url, {params: data});
}

//维护修改
export function reviseMaintain(username,contact,remark,status,type){
    let url='/rank/maintain-data';
    let data={
        username:username,
        contact:contact,
        remark:remark,
        status:status,
        type:type
    }
    return api.post(url,data);
}

//sys后台排行榜(渠道充值)
export function  agentRank(time,username,page,pageSize,sort_by,sort_name){
    let url='/rank/agent';
    let data={
        start_time:time[0]?time[0]:0,
        end_time:time[1]?time[1]:0,
        username:username,
        page:page,
        pageSize:pageSize,
        sort_by:sort_by,
        sort_name:sort_name
    }
    return api.get(url, {params: data});
}


//sys后台详情(渠道充值)
export function  agentDetail(time,username,page,pageSize,type){
    let url='/rank/agent-details';
    let data={
        start_time:time[0]?time[0]:0,
        end_time:time[1]?time[1]:0,
        username:username,
        page:page,
        pageSize:pageSize,
        search:type
    }
    return api.get(url, {params: data});
}


